package cuishifeng.blog.learn.concurrent.join;

import java.util.concurrent.TimeUnit;

/**
 * @author cuishifeng <cuishifeng0207@163.com>
 * Created on 2021-02-28
 */
public class ThreadJoin {


    public static void main(String[] args) throws InterruptedException {

        Thread joinThread = new Thread(new JoinRunner(), "JoinRunner");
        joinThread.start();
        joinThread.join();
        System.out.println("hello");


    }


    public static class JoinRunner implements Runnable {

        @Override
        public void run() {
            System.out.println("JoinRunner start");
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
